package com.tructc.vwad

class MeetingController {

	MeetingService meetingService
	VideoService videoService



	
	def index() {
		[meetings : meetingService.listMeeting()];
	}

	def add() {
		
	}


	def addMeeting() {

		def meetingType = request.getParameter("meeting-type");
		def meetingLocation = request.getParameter("meeting-location");
		def meetingDescription = request.getParameter("meeting-description");

		Meeting added_meeting = meetingService.addMeeting(meetingType, meetingLocation, meetingDescription);

		response.status = 200;
		render(contentType : 'text/json') {[ meeting : added_meeting ]};
	}

	def upload() {
		def meetingVideo = request.getFile("meetingVideo");
		def meetingId = request.getParameter("meetingId");

		if(videoService.upload(meetingVideo, request.getParameter("name"), meetingId)) {
			response.status = 200;
		} else {
			println("No file uploaded");
		}

		render "No direct access"
	}

	

	def record()
	{

	}
}
